<html xmlns="http://www.w3.org/1999/xhtml"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:p="http://primefaces.org/ui"
	xmlns:ui="http://java.sun.com/jsf/facelets">
<f:view contentType="text/html" locale="en">
	<h:head />
	<h:body>
		<div class="wrap container">
			<ui:include src="/views/blocks/header.xhtml" />
			<h:form id="mailSenderForm">
				<h:panelGrid columns="2" styleClass="margin">
					<h:outputLabel for="userList" value="Select recepients: " styleClass="margin"/>
					<p:selectCheckboxMenu value="#{mailSenderBean.selectedUsers}"
						id="userList" label="Users: " filter="true"
						filterMatchMode="startsWith" styleClass="margin">
						<f:selectItems value="#{userBean.getUsers()}" var="user"
							itemValue="#{user.email}" itemLabel="#{user.username}" />
					</p:selectCheckboxMenu>

					<h:outputLabel value="Subject: " styleClass="margin"/>
					<p:inputText value="#{mailSenderBean.mail.subject}" styleClass="margin"/>
				</h:panelGrid>
				<p:editor value="#{mailSenderBean.mail.body}" styleClass="margin"></p:editor>
				<p:commandButton id="submit" styleClass="btn btn-xs btn-success"
					style="margin-left: 5px;" value="Send message"
					action="#{mailSenderBean.sendMessages}" update="mailSenderForm" />
				<p:messages id="messages" showDetail="true" autoUpdate="true"
					closable="true" />
			</h:form>
		</div>
	</h:body>
</f:view>
</html>